

public class Main{
	public static void main(String[] args){

		System.out.println("thread A start");

		Thread threadB=new Thread(
			new Runnable(){
				public void run(){
					try{
						System.out.println("thread B start");
						for(int i=0;i<5;i++){

							System.out.println("thread B going");
							Thread.sleep(1000);	
						}
						System.out.println("thread B stop----");
					}
					catch(InterruptedException e){
						e.printStackTrace();

					}
				}
			}
		);
		
	
		threadB.start();

		try{
			threadB.join();
		}
		catch(InterruptedException e){
			e.printStackTrace();
		}


		System.out.println("thread A stop----");
	}

}